<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .HolyGrail {
            display: flex;
            min-height: 100vh;
            flex-direction: column;
        }

        header,
        footer {
            flex: 1;
            background-color: #ccc;
            margin: 5px;
        }

        .HolyGrail-body {
            display: flex;
            flex: 1;
        }

        .HolyGrail-content {
            flex: 1;
            background-color: #ccc;
            margin: 5px;
        }

        .HolyGrail-nav,
        .HolyGrail-ads {
            /* 两个边栏的宽度设为12em */
            flex: 0 0 12em;
            background-color: #ccc;
            margin: 5px;
        }

        .HolyGrail-nav {
            /* 导航放到最左边 */
            order: -1;
        }

        /* 如果是小屏幕，躯干的三栏自动变为垂直叠加。 */
        @media (max-width: 768px) {
            .HolyGrail-body {
                flex-direction: column;
                flex: 1;
            }

            .HolyGrail-nav,
            .HolyGrail-ads,
            .HolyGrail-content {
                flex: auto;
            }
        }
    </style>
</head>



<body class="HolyGrail">
    <header>...</header>
    <div class="HolyGrail-body">
        <main class="HolyGrail-content">...</main>
        <nav class="HolyGrail-nav">...</nav>
        <aside class="HolyGrail-ads">...</aside>
    </div>
    <footer>...</footer>
</body>



</html>